#!/usr/bin/perl
#
#
$senNum=1;
$senStart = 1;
while($line=<STDIN>) {
	chomp($line);
	if($line=~/^\s*$/) {
		print "\n";
		$senNum++;
		$senStart=1;
		next;
	}
	
	if($senStart==1) {
		print "\n".$senNum;
		$senStart=0;
	}

	($wordPosRoot,@features)=split(/\s+/,$line);
	($wd,$pos,$root) = split(/_+/,$wordPosRoot);
	$wd = "-UNSCR-" if(!$wd);
	$root = $wd if(!$root);
	$wordPosRoot = "$wd\_$pos\_$root";
	print "\n".$wordPosRoot;
	$tense=0;$gnp=0;$vib=0;

	foreach $feat (@features) {
		($key,$value)=split(/:/,$feat);
		if($key=~/GNP/) {
			$value=~s/^.//g;
			$value=~s/.$//g;
			@v=split(/\,/,$value);
			print "\tgnp:";
			if($v[0] eq "any") {
				$v[0] = "m";
			}
			if($v[1] eq "any") {
				$v[1]="sg";
			}
			if($v[2] eq "any") {
				$v[2] = "3";
			}
			if($v[3] eq "") {
				$v[3] = "d";
			}
			print $v[0];
			print $v[2];
			print $v[1];
			print $v[3];
			$gnp=1;
		}
		elsif($key=~/AUX/) {
			print "\ttense:$value";
			$tense=1;
		}
		elsif($key=~/PREP/) {
			print "\tvib:$value";
			$vib=1;
		}
	}	
	print "\tvib:NULL" if(!$vib);
	print "\ttense:NULL" if(!$tense);
	print "\tgnp:NULL" if(!$gnp);
}

